#include <iostream>
#include <cstdio>

using namespace std;

int bank = 0;
int month = 0, cost = 0, remain = 0;

void save(){
    if(remain < 100){
        return ;
    }
    else{
        bank += remain / 100;
        remain %= 100;
        return ;
    }
}

int main(){
    bool tag = true;
    for(int i = 1; i <= 12; i++){
        remain += 300;
        scanf("%d", &cost);
        remain -= cost;
        if(remain < 0){
            tag = false;
            month = i;
            break;
        }
        save();

    }
    if(tag) cout << remain + 120*bank <<endl;
    else    cout << -month << endl;
    return 0;
}